// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router/index'
import Cookies from 'js-cookie'
import './assets/icons' // icon
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import ElementUI from 'element-ui' // element-ui的全部组件
import 'element-ui/lib/theme-chalk/index.css'// element-ui的css
import './styles/element-variables.scss'
import './styles/index.scss' // global css
// import './styles/ruoyi.scss' // ruoyi css
import { parseTime, addDateRange, download, handleTree, resetForm, selectDictLabel } from './utils/ruoyi'
import store from './store/index'
import './permission'
import Pagination from './components/Pagination/Pagination'
import moment from 'moment'
import './directive/hasPermission'
// 全局挂载组件
Vue.component('Pagination', Pagination)
// 全局方法进行挂载

Vue.prototype.addDateRange = addDateRange
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.resetForm = resetForm
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.apiUrl = process.env.VUE_APP_BASE_API

Vue.prototype.moment = moment

Vue.prototype.msgSuccess = function (msg) {
  this.$message({showClose: true, message: msg, type: 'success'})
}
Vue.prototype.msgError = function (msg) {
  this.$message({showClose: true, message: msg, type: 'error'})
}

Vue.use(ElementUI, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})
Vue.prototype.parseTime = parseTime
Vue.config.productionTip = false
/* eslint-disable no-new */

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
